Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated for WorldEdit 6.0 #542

Merged
merged 1 commit into from
Feb 22, 2015
Merged

Updated for WorldEdit 6.0 #542

merged 1 commit into from
Feb 22, 2015

Conversation

DarkArc
Copy link

@DarkArc DarkArc commented Apr 4, 2014

Testing is pending.

@DarkArc
Copy link
Author

DarkArc commented Apr 4, 2014

Working in Test & Implemented to the WorldEdit specs for a block logger (to the best of my knowledge)

@@ -57,7 +58,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
name = "Creeper";
} else if (source instanceof Fireball) {
Fireball fireball = (Fireball) source;
Entity shooter = fireball.getShooter();
ProjectileSource shooter = fireball.getShooter();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate pull :P

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mkay :p

@sk89q
Copy link

sk89q commented Apr 4, 2014

I would not necessarily use this yet, as the API in WE may change a bit in the next week.

@mibby
Copy link

mibby commented Apr 5, 2014

@DarkArc Compiled your branch again, get this error when typing /lb redo player (player) area (#) time (time)

[04:52:45] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'lb' in plugin LogBlock v1.81
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1370]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) ~[spigot.jar:git-Spigot-1370]
    at org.bukkit.craftbukkit.v1_7_R2.CraftServer.dispatchCommand(CraftServer.java:719) ~[spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.PlayerConnection.handleCommand(PlayerConnection.java:984) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.PlayerConnection.a(PlayerConnection.java:829) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.NetworkManager.a(NetworkManager.java:148) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.ServerConnection.c(ServerConnection.java:77) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.MinecraftServer.v(MinecraftServer.java:703) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.DedicatedServer.v(DedicatedServer.java:273) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.MinecraftServer.u(MinecraftServer.java:566) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.MinecraftServer.run(MinecraftServer.java:472) [spigot.jar:git-Spigot-1370]
    at net.minecraft.server.v1_7_R2.ThreadServerApplication.run(SourceFile:618) [spigot.jar:git-Spigot-1370]
Caused by: java.lang.NoClassDefFoundError: de/diddiz/LogBlock/CommandsHandler$CommandRedo
    at de.diddiz.LogBlock.CommandsHandler.onCommand(CommandsHandler.java:234) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1370]
    ... 13 more
Caused by: java.lang.ClassNotFoundException: de.diddiz.LogBlock.CommandsHandler$CommandRedo
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_20-ea]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_20-ea]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_20-ea]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_20-ea]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[spigot.jar:git-Spigot-1370]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[spigot.jar:git-Spigot-1370]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_20-ea]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_20-ea]
    at de.diddiz.LogBlock.CommandsHandler.onCommand(CommandsHandler.java:234) ~[?:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1370]
    ... 13 more

@DarkArc
Copy link
Author

DarkArc commented Apr 5, 2014

@mibby That shouldn't happen, it compiles fine for me, I also didn't touch the commands system, so it's extra strange...

@mibby
Copy link

mibby commented Apr 5, 2014

Odd. It compiled fine for me too. Just using the command in-game, it errors. I'll recompile with your newer commit and test again later today.

@DarkArc
Copy link
Author

DarkArc commented Apr 6, 2014

@mibby Still getting this error?

return;
}

Location location = new Location(((BukkitWorld) event.getWorld()).getWorld(), pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event.getWorld() could return ForgeWorld if people install WorldEdit in both Forge and Bukkit at the same time (via MCPC-Plus), or SomeOtherWorld if people made a custom world.

You could also handle this outside onBlockChange(...).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't matter that the world was a forge world and a bukkit world at the same time would it, just so long as it has the bukkit features we need?

EDIT: Oh... I just realized what you meant, it would return a ForgeWorld despite supporting bukkit features.

@jomo
Copy link

jomo commented Jun 15, 2014

the API in WE may change a bit in the next week

@sk89q is that week over now? :P

@DarkArc
Copy link
Author

DarkArc commented Jun 15, 2014

The code base for 6.0 is still not complete and is still subject to change afaik. It's best not to merge this till WE 6 is actually released, I'll keep this updated as any breaking changes are made.

@frymaster frymaster mentioned this pull request Jun 30, 2014
@PiLoT-
Copy link

PiLoT- commented Jan 6, 2015

does this mean WE has broken LBs ability to log WE or LB has made a recent change that renders it unable to log WE

@jomo
Copy link

jomo commented Jan 6, 2015

WE has made breaking changes and LB didn't update since. However this PR seems to be working.

@PiLoT-
Copy link

PiLoT- commented Jan 6, 2015

@jomo can you provide link to where i can get the working build if poss?

@jomo
Copy link

jomo commented Jan 6, 2015

No idea if Dark has a build server, I just used maven and built it myself.

@PiLoT-
Copy link

PiLoT- commented Jan 6, 2015

@jomo ah well i havent learned that much ill just wait lol

frymaster referenced this pull request Feb 14, 2015
…is. Fixes #538, fixes #568

This creates a new column in the lb-players table called UUID. If this is in the form of a UUID,
it's assumed to be a player. If not, it's assumed to be a server entity (zombie, sheep, or
WaterFlow, LavaFlow etc.). LogBlock will set the UUID of entities to "log_" plus their name
(i.e. log_zombie or log_sheep)

To assist this is a new class Actor, which wraps a name/UUID pair, with constructors that will
generate one from server entities, or SQL results. Every listener and every class in Consumer
needed to be updated to deal with this

As of yet, only the playername is displayed in results (although the queries do return UUID data).
Similarly, you can only query by name (the database stores the last name they have logged in as).
In addition, the WorldEdit hook has been disabled (is not compiled) since LB needs to be updated
to use their new API, and the LB code hook has to extract UUID information for insertion.

The UUID importer assumes any player with an onlinetime of 0 is a server-generated source, and set
the UUID as above (log_sheep etc.).  For everything else, it sends 100 names at a time to Mojang's
name->UUID service, and records them if available.  If no result is found, it records their UUID as
noimport_theirname.  As this is more likely than other updates to be interrupted mid-way, the
importer is tolerant of e.g. the column already being added, and will resume where it left off.
@frymaster
Copy link
Member

@DarkArc I've updated this PR for the new UUID support*. Given you comment here would you prefer I opened a new PR to continue this so you don't get the hassle?

My branch is at https://github.com/frymaster/LogBlock/tree/DarkArc-worldedit-6.0.0

* Which means "it builds" - I'm at work atm so can't test until I get home

@DarkArc
Copy link
Author

DarkArc commented Feb 18, 2015

Nah, I've got some time. I don't have an environment to test anything anymore, but I can comment.

My only suggestion is the conversion could be changed slightly:
https://github.com/frymaster/LogBlock/blob/ed5e40f46943725cf53b2b5a38d750d31615d622/src/main/java/de/diddiz/worldedit/WorldEditLoggingHook.java#L32-L37

You should be able to make use of the Identifiable interface, and directly access the UUID, and not have to worry about doing an Entity look up:
https://github.com/sk89q/WorldEdit/blob/master/worldedit-core/src/main/java/com/sk89q/worldedit/util/Identifiable.java

Also, I'm not sure what @sk89q decided, but before I left, there was some discussion that the following should be used for the world look up:
https://github.com/sk89q/WorldEdit/blob/master/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java#L70-L88

However, this is still a package local class, and thereby method. If it becomes the case that this is accessible, the below implementation of world look up could be used, with the contents of the try block being replaced by the BukkitAdapter's world adapt method:
https://github.com/DarkArc/LogBlock/blob/fa11095d43eff9c498aa137ed5b620ab3994a877/src/main/java/de/diddiz/worldedit/WorldEditLoggingHook.java#L38-L54

The concern with just using the name look up was that on multiple API WorldEdit platforms (where more than one API is being used at once), there might be inconsistencies in the look up.

Edit: Corrected some grammar.

@frymaster
Copy link
Member

https://github.com/frymaster/LogBlock/blob/DarkArc-worldedit-6.0.0/src/main/java/de/diddiz/worldedit/WorldEditLoggingHook.java#L52-L66

That method is still inaccessible, so I had to move the logic into our code. If we can get a BukkitWorld object to spit out a Bukkit World, we will. Otherwise, we'll try looking for one with the same name. Is that what you had in mind?

@DarkArc
Copy link
Author

DarkArc commented Feb 22, 2015

That seems fine, might be better if you refactored the world lookup logic into it's own function though, so that try catch isn't so messy. Basically, giving the class it's own adapt method.

@frymaster frymaster merged commit fa1e1b7 into LogBlock:master Feb 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants